﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace PaliTextReader2.Utilities
{
    class FolderPermission
    {
        public static bool IsFolderWriteable(string strFolderName)
        {
            bool bRetVal = true;
            try
            {
                using (FileStream fstream = new FileStream(strFolderName+"/test.txt", FileMode.Create))         
                using (TextWriter writer = new StreamWriter(fstream))         
                {                 
                    writer.WriteLine("sometext");  
                }

                File.Delete(strFolderName + "/test.txt");
            }
            catch (Exception)
            {
                bRetVal = false;
            }

            return bRetVal;
        }
    }
}
